package com.wt.controller;

import com.wt.Pojo.User;
import com.wt.service.UserService1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping
@RestController
public class ConsumerController {
    //resource  根据byName注入
    //autowired 根据byType注入

    @Autowired
    private UserService1 userService1;

    @PostMapping
    public String Add(User user){
        System.out.println("2add---user=="+user);
        return userService1.Add(user);
    }

    @DeleteMapping("/{id}")
    public String Del(@PathVariable("id") Integer id){
        System.out.println("2id=="+id);
        return userService1.Del(id);
    }


    @PutMapping
    public String Update(User user){
        System.out.println("2put--user=="+user);
        return userService1.Update(user);
    }


    @GetMapping
    public String Get(String name,Integer age){
        System.out.println("2name=="+name+"   age="+age);
        return userService1.Get(name,age);
    }

  /*  @GetMapping
    public List<User> GetUser(@RequestBody User user){
        System.out.println("2user=="+user);
        List<User> users = userService1.GetUser(user);
        return users;
    }*/
}
